using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using FytSoa.Service.DtoModel;
using FytSoa.Service.Interfaces;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using FytSoa.Common;
using FytSoa.Core.Model;

namespace FytSoa.Api.Areas.Circle.Controllers
{
    [Route("api/circle/[controller]")]
    [ApiController]
    public class CommonController:ControllerBase
    {
        private readonly ICmsCommentService _commonService;
        public CommonController(ICmsCommentService commonService){
            _commonService=commonService;
        }

        //查询评论分页
        [HttpPost("page")]
        public async Task<IActionResult> GetCommonPage([FromBody]PageParm param)
        {
            return Ok(await _commonService.GetPageCommon(param));
        }

        //发表评论
        [HttpPost("add")]
        public async Task<IActionResult> AddCommon([FromBody]Core.Model.Cms.CmsComment model)
        {
            model.Guid=Guid.NewGuid().ToString();
            model.AddDate=DateTime.Now;
            model.Star=1;
            return Ok(await _commonService.AddAsync(model));
        }
    }
}
